import shutil
import os

#删除文件夹
def del_dir(dir_path):
    shutil.rmtree(dir_path)

his = open('./history.txt','r')
count = 0
lines = []

for line in his:
    lines.append(line.replace('\n',''))

while len(lines)>10:
    del_dir('./outputs/'+lines[0])
    lines = lines[1:]
whis = open('./history.txt','w')
for i in lines:
    whis.write(i+'\n')
old = lines[-2]
new = lines[-1]

os.system('rm -rf ./difference/*')
os.system('bash ./diff.sh '+old+' '+new)